using System;
using System.Collections.Generic;

namespace DuplexTransformers
{
    public static class TypeExtensions
    {
        public static bool IsGenericList(this Type @this)
        {
            if (@this.IsGenericType) return @this.GetGenericTypeDefinition() == typeof (IList<>);
            return false;
        }

        public static Type GetListItemType(this Type @this)
        {
            return @this.GetGenericArguments()[0];
        }
    }
}